\doxysection{my\+\_\+tree.\+h}
\hypertarget{my__tree_8h_source}{}\label{my__tree_8h_source}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#include<iostream>}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#include<vector>}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#include<stack>}}
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include<queue>}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include<algorithm>}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include<string>}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include<functional>}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include<cassert>}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include<cstdlib>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include<cmath>}}
\DoxyCodeLine{00011\ \textcolor{keyword}{using\ namespace\ }std;}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00016\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ space\ =\ -\/999;}
\DoxyCodeLine{00017\ }
\DoxyCodeLine{00018\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/工具函数-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00027\ \textcolor{keywordtype}{int}\ clac\_space(\textcolor{keywordtype}{int}\ h,\ \textcolor{keywordtype}{int}\ height)\ \{}
\DoxyCodeLine{00028\ \ \ \ \ \textcolor{keywordtype}{int}\ width\ =\ 3\ *\ pow(2,\ height\ -\/\ 1);\ \ \textcolor{comment}{//\ 树的总宽度（像素单位）}}
\DoxyCodeLine{00029\ \ \ \ \ \textcolor{keywordtype}{int}\ now\_point\ =\ pow(2,\ h\ -\/\ 1);\ \ \ \ \ \ \ \textcolor{comment}{//\ 当前行的节点总数}}
\DoxyCodeLine{00030\ \ \ \ \ \textcolor{keywordtype}{float}\ ans\_num\ =\ (float)width\ /\ now\_point;\ \ \textcolor{comment}{//\ 每个节点分配的宽度}}
\DoxyCodeLine{00031\ \ \ \ \ \textcolor{keywordtype}{int}\ ans\_space\ =\ (ans\_num\ -\/\ 1)\ /\ 2;\ \ \ \textcolor{comment}{//\ 节点前的空格数（居中对齐）}}
\DoxyCodeLine{00032\ \ \ \ \ \textcolor{keywordflow}{return}\ ans\_space;}
\DoxyCodeLine{00033\ \}}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00040\ \textcolor{keywordtype}{void}\ print\_fulltov(vector<int>\&\ v,\ \textcolor{keywordtype}{int}\ x)\ \{}
\DoxyCodeLine{00041\ \ \ \ \ v.push\_back(x);}
\DoxyCodeLine{00042\ \}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \textcolor{keyword}{static}\ \textcolor{keywordtype}{int}\ function\_counter;\ \ \textcolor{comment}{//\ 用于遍历向量时的索引计数（全局辅助变量）}}
\DoxyCodeLine{00051\ \textcolor{keywordtype}{void}\ print\_tov(vector<int>\&\ v,\ \textcolor{keywordtype}{int}\ x)\ \{}
\DoxyCodeLine{00052\ \ \ \ \ \textcolor{keywordflow}{if}\ (function\_counter\ <\ v.size())\ \{}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ v[function\_counter]\ =\ x;}
\DoxyCodeLine{00054\ \ \ \ \ \}}
\DoxyCodeLine{00055\ \}}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ }
\DoxyCodeLine{00062\ \textcolor{keywordtype}{void}\ empty\_function()\ \{}
\DoxyCodeLine{00063\ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00064\ \}}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00070\ \textcolor{keywordtype}{void}\ print(\textcolor{keywordtype}{int}\ x)\ \{}
\DoxyCodeLine{00071\ \ \ \ \ cout\ <<\ x\ <<\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00072\ \}}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00078\ \textcolor{keywordtype}{void}\ self\_increase(\textcolor{keywordtype}{int}\&\ x)\ \{}
\DoxyCodeLine{00079\ \ \ \ \ x++;}
\DoxyCodeLine{00080\ \}}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00088\ \textcolor{keywordtype}{bool}\ is\_2\_power(\textcolor{keywordtype}{int}\ num,\ \textcolor{keywordtype}{int}\ height)\ \{}
\DoxyCodeLine{00089\ \ \ \ \ vector<int>\ v;}
\DoxyCodeLine{00090\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 1;\ i\ <=\ height;\ i++)\ \{}
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ v.push\_back(pow(2,\ i));}
\DoxyCodeLine{00092\ \ \ \ \ \}}
\DoxyCodeLine{00093\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ v\_num\ :\ v)\ \{}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (v\_num\ ==\ num)\ \{}
\DoxyCodeLine{00095\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00097\ \ \ \ \ \}}
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00099\ \}}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00108\ \textcolor{keywordtype}{int}\ lowbit(\textcolor{keywordtype}{int}\ x)\ \{}
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keywordflow}{return}\ x\ \&\ -\/x;}
\DoxyCodeLine{00110\ \}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00112\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/模板声明-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00114\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00115\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree}};}
\DoxyCodeLine{00116\ }
\DoxyCodeLine{00117\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00118\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a9b5581a82079878a7faac62d07bbcc12}{operator==}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ lhs,\ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ rhs);}
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00121\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a57bcf0e8e11dcb2db4d3c2b72e62d913}{operator!=}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ lhs,\ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ rhs);}
\DoxyCodeLine{00122\ }
\DoxyCodeLine{00123\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00124\ ostream\&\ \mbox{\hyperlink{classmy__binary__tree_a9b9d88b02caf22fc6de3a78e3a514816}{operator<<}}(ostream\&\ os,\ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ p);}
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00126\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00127\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classmy__binary__search__tree}{my\_binary\_search\_tree}};}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00129\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00130\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classmy__complete__binary__tree}{my\_complete\_binary\_tree}};}
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00133\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classmy__full__binary__tree}{my\_full\_binary\_tree}};}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ }
\DoxyCodeLine{00136\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/定义主类-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00143\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00144\ \textcolor{keyword}{class\ }\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}\ \{}
\DoxyCodeLine{00145\ \ \ \ \ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00146\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};\ \ \ \ \ \ \ }
\DoxyCodeLine{00148\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};\ \ \ \ \ \ }
\DoxyCodeLine{00149\ \ \ \ \ }
\DoxyCodeLine{00150\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00151\ \ \ \ \ \ \ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/构造相关-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00157\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}(T\ val)\ :\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}(val),\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}(NULL),\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}(NULL)\ \{\}}
\DoxyCodeLine{00158\ \ \ \ \ }
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_a6faf690077dab82f4d1f72920c3834fd}{my\_binary\_tree}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\&\ other)\ :\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}(other.\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}),\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}(NULL),\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}(NULL)\ \{}
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (other.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ =\ \textcolor{keyword}{new}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(*other.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}});}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ \ \ \ \ if\ (other.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ =\ \textcolor{keyword}{new}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(*other.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}});}
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00168\ \ \ \ \ }
\DoxyCodeLine{00173\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_aabd378c4f70ed8c8e76691769d111c59}{\string~my\_binary\_tree}}()\ \{}
\DoxyCodeLine{00174\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \textcolor{keyword}{delete}\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00175\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \textcolor{keyword}{delete}\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00176\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00177\ \ \ \ \ }
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a488bf2adcd7de91b9e259f6ef8c7762b}{construct\_binary\_tree}}(vector<T>\ values,\ \textcolor{keywordtype}{int}\ index,\ T\ space);}
\DoxyCodeLine{00187\ }
\DoxyCodeLine{00192\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a6f45e4cb6774b092b40bee77ee80b757}{mirror}}();}
\DoxyCodeLine{00193\ \ \ \ \ }
\DoxyCodeLine{00194\ \ \ \ \ \ \ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/查询相关-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a8fc393aceaa7e46fc5fb6b9377c12ea3}{is\_empty}}();}
\DoxyCodeLine{00200\ \ \ \ \ }
\DoxyCodeLine{00205\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{classmy__binary__tree_a05b6069959ff87dc7824ce4e05db024a}{get\_value}}();}
\DoxyCodeLine{00206\ \ \ \ \ }
\DoxyCodeLine{00212\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{classmy__binary__tree_a05b6069959ff87dc7824ce4e05db024a}{get\_value}}(\textcolor{keywordtype}{string}\ position);}
\DoxyCodeLine{00213\ \ \ \ \ }
\DoxyCodeLine{00219\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00220\ \ \ \ \ }
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_ad8ae3e1b3073a79df62de135e337192a}{get\_h\_layer\_nodes}}(\textcolor{keywordtype}{int}\ h);}
\DoxyCodeLine{00228\ \ \ \ \ }
\DoxyCodeLine{00234\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_a76f83530b098d7ad84262d21c885c15d}{get\_last\_layer\_nodes}}();}
\DoxyCodeLine{00235\ \ \ \ \ }
\DoxyCodeLine{00241\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_aabf0c965e92e633f4d25f9b88da19a28}{get\_nodes\_num}}();}
\DoxyCodeLine{00242\ \ \ \ \ }
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a9279b204f13b6f6e79646fe38387607a}{get\_lrest\_leave}}(\textcolor{keywordtype}{string}\ l\_or\_r);}
\DoxyCodeLine{00250\ \ \ \ \ }
\DoxyCodeLine{00256\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_adb685df412bb6481f5167165312868ad}{is\_binary\_search\_tree}}();}
\DoxyCodeLine{00257\ \ \ \ \ }
\DoxyCodeLine{00264\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a490bf7f8ebe87b6040b1294f73979fea}{find}}(\textcolor{keywordtype}{int}\ val);}
\DoxyCodeLine{00265\ \ \ \ \ }
\DoxyCodeLine{00272\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_ad767eada19d83ada460c5eb0c2104056}{find\_father}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ son);}
\DoxyCodeLine{00273\ \ \ \ \ }
\DoxyCodeLine{00279\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a35c9081b6b3dfe457c8d29697ccfdfb1}{is\_balence\_binary\_tree}}();}
\DoxyCodeLine{00280\ \ \ \ \ }
\DoxyCodeLine{00281\ \ \ \ \ \ \ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/增删相关-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00288\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_aa23b0dbc0a4f4f7741111867f6d8b2e9}{append}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ another\_tree,\ \textcolor{keywordtype}{string}\ l\_or\_r);}
\DoxyCodeLine{00289\ \ \ \ \ }
\DoxyCodeLine{00296\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a19f020b91ef749755745ac08d69be0b6}{copy}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ des,\ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ src);}
\DoxyCodeLine{00297\ \ \ \ \ }
\DoxyCodeLine{00304\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a9675071237ce43751138c4fa3ef43657}{insert}}(T\ val,\ \textcolor{keywordtype}{string}\ position);}
\DoxyCodeLine{00305\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00311\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a24a14198a85ebfd603f5284ef9940e41}{delete\_point}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ point);}
\DoxyCodeLine{00312\ \ \ \ \ }
\DoxyCodeLine{00318\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a5fe4fbbeb0729ef67cc258d2a5350860}{delete\_pos}}(\textcolor{keywordtype}{string}\ position);}
\DoxyCodeLine{00319\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00326\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a5842011f1564adb291d8a62f1f7e7625}{revolve}}(\textcolor{keywordtype}{string}\ mode);\ }
\DoxyCodeLine{00327\ \ \ \ \ }
\DoxyCodeLine{00334\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_abf00c3450fd579d439c231202d2af556}{revolve}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ node,\ \textcolor{keywordtype}{string}\ mode);}
\DoxyCodeLine{00335\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00336\ \ \ \ \ }
\DoxyCodeLine{00337\ \ \ \ \ \ \ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/遍历操作-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00343\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a3b473ee42358d2ecda1958b1b72fd1dd}{show\_binary\_tree}}(\textcolor{keywordtype}{string}\ mode);}
\DoxyCodeLine{00344\ \ \ \ \ }
\DoxyCodeLine{00353\ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ Function>}
\DoxyCodeLine{00354\ \ \ \ \ \ \ \ \ Function\ \mbox{\hyperlink{classmy__binary__tree_a4a4f092d8f75d1f8840db3c3b4b6f36e}{traversal\_binary\_tree}}(\textcolor{keywordtype}{string}\ mode,\ Function\ F);}
\DoxyCodeLine{00355\ \ \ \ \ }
\DoxyCodeLine{00366\ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ Function1,\ \textcolor{keyword}{typename}\ Function2>}
\DoxyCodeLine{00367\ \ \ \ \ \ \ \ \ Function1\ \mbox{\hyperlink{classmy__binary__tree_a4a4f092d8f75d1f8840db3c3b4b6f36e}{traversal\_binary\_tree}}(\textcolor{keywordtype}{string}\ mode,\ Function1\ F1,\ Function2\ F2);}
\DoxyCodeLine{00368\ \ \ \ \ }
\DoxyCodeLine{00374\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_aff9c3c138c4fc970016a826ec0653eaf}{print\_full\_to\_vector}}(vector<T>\&\ vv);}
\DoxyCodeLine{00375\ \ \ \ \ }
\DoxyCodeLine{00381\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_aa65e9e0bae93b835e20c32de429928d3}{print\_to\_vector}}(vector<T>\&\ vv);}
\DoxyCodeLine{00382\ \ \ \ \ }
\DoxyCodeLine{00383\ \ \ \ \ \ \ \ \ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/操作符重载-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00390\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\&\ \mbox{\hyperlink{classmy__binary__tree_aedeb2af1e014d361fb7c2f1423e9f58d}{operator=}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\&\ other)\ \{}
\DoxyCodeLine{00391\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ !=\ \&other)\ \{}
\DoxyCodeLine{00392\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ =\ other.\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};}
\DoxyCodeLine{00393\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \textcolor{keyword}{delete}\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00394\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \textcolor{keyword}{delete}\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00395\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (other.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ =\ \textcolor{keyword}{new}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(*other.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}});}
\DoxyCodeLine{00396\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (other.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ =\ \textcolor{keyword}{new}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(*other.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}});}
\DoxyCodeLine{00397\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00398\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00399\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00400\ \ \ \ \ }
\DoxyCodeLine{00408\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a9b5581a82079878a7faac62d07bbcc12}{operator==<>}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ lhs,\ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ rhs);}
\DoxyCodeLine{00409\ \ \ \ \ }
\DoxyCodeLine{00417\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a57bcf0e8e11dcb2db4d3c2b72e62d913}{operator!=<>}}(\mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ lhs,\ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ rhs);}
\DoxyCodeLine{00418\ \ \ \ \ }
\DoxyCodeLine{00426\ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ ostream\&\ operator<<<>(ostream\&\ os,\ \mbox{\hyperlink{classmy__binary__tree}{my\_binary\_tree<T>}}\ p);}
\DoxyCodeLine{00427\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00434\ \ \ \ \ \ \ \ \ T\ \mbox{\hyperlink{classmy__binary__tree_a52db051eb0ccae70e61baf638acd2f81}{operator[]}}(\textcolor{keywordtype}{int}\ index)\{}
\DoxyCodeLine{00435\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ height\ =\ \mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00436\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ h\ =\ 1;}
\DoxyCodeLine{00437\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ sum\ =\ pow(2,\ height)\ -\/\ 1;}
\DoxyCodeLine{00438\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
\DoxyCodeLine{00439\ \ \ \ \ \ \ \ \ \ \ \ \ vector<T>\ vv(sum,\ space);\ \ \textcolor{comment}{//\ 初始化向量为占位符}}
\DoxyCodeLine{00440\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_aa65e9e0bae93b835e20c32de429928d3}{print\_to\_vector}}(vv);}
\DoxyCodeLine{00441\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ vv[index];}
\DoxyCodeLine{00442\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00443\ \};}
\DoxyCodeLine{00444\ }
\DoxyCodeLine{00445\ \textcolor{comment}{//定义主类的函数}}
\DoxyCodeLine{00446\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/构造相关-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00447\ \textcolor{comment}{//\ 层先法构造二叉树的函数}}
\DoxyCodeLine{00448\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00449\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a488bf2adcd7de91b9e259f6ef8c7762b}{my\_binary\_tree<T>::construct\_binary\_tree}}(vector<T>\ values,\ \textcolor{keywordtype}{int}\ index,\ T\ space)\ \{}
\DoxyCodeLine{00450\ \ \ \ \ \textcolor{keywordflow}{if}\ (index\ >=\ values.size())\ \{}
\DoxyCodeLine{00451\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00452\ \ \ \ \ \}}
\DoxyCodeLine{00453\ \ \ \ \ \textcolor{keywordflow}{if}\ (values[index]\ ==\ space)\ \{}
\DoxyCodeLine{00454\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ node\ =\ NULL;}
\DoxyCodeLine{00455\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ node;}
\DoxyCodeLine{00456\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00457\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ node\ =\ \textcolor{keyword}{new}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}(values[index]);}
\DoxyCodeLine{00458\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ 注意：原代码此处调用construct\_full\_binary\_tree可能是笔误，修正为construct\_binary\_tree}}
\DoxyCodeLine{00459\ \ \ \ \ \ \ \ \ node-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ =\ \mbox{\hyperlink{classmy__binary__tree_a488bf2adcd7de91b9e259f6ef8c7762b}{construct\_binary\_tree}}(values,\ 2\ *\ index\ +\ 1,\ space);}
\DoxyCodeLine{00460\ \ \ \ \ \ \ \ \ node-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ =\ \mbox{\hyperlink{classmy__binary__tree_a488bf2adcd7de91b9e259f6ef8c7762b}{construct\_binary\_tree}}(values,\ 2\ *\ index\ +\ 2,\ space);}
\DoxyCodeLine{00461\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ node;}
\DoxyCodeLine{00462\ \ \ \ \ \}}
\DoxyCodeLine{00463\ \}}
\DoxyCodeLine{00464\ }
\DoxyCodeLine{00465\ }
\DoxyCodeLine{00466\ \textcolor{comment}{//镜像}}
\DoxyCodeLine{00467\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00468\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a6f45e4cb6774b092b40bee77ee80b757}{my\_binary\_tree<T>::mirror}}()\ \{}
\DoxyCodeLine{00469\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\textcolor{keyword}{this})\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00470\ \ \ \ \ swap(\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}},\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}});}
\DoxyCodeLine{00471\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>mirror();\ \ \textcolor{comment}{//\ 避免空指针调用（原代码直接调用可能崩溃）}}
\DoxyCodeLine{00472\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>mirror();}
\DoxyCodeLine{00473\ \}}
\DoxyCodeLine{00474\ }
\DoxyCodeLine{00475\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/查询相关-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00476\ \textcolor{comment}{//查询空}}
\DoxyCodeLine{00477\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00478\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a8fc393aceaa7e46fc5fb6b9377c12ea3}{my\_binary\_tree<T>::is\_empty}}()\ \{}
\DoxyCodeLine{00479\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{this}\ ==\ NULL;}
\DoxyCodeLine{00480\ \}}
\DoxyCodeLine{00481\ }
\DoxyCodeLine{00482\ \textcolor{comment}{//查询根节点值}}
\DoxyCodeLine{00483\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00484\ T\ \mbox{\hyperlink{classmy__binary__tree_a05b6069959ff87dc7824ce4e05db024a}{my\_binary\_tree<T>::get\_value}}()\ \{}
\DoxyCodeLine{00485\ \ \ \ \ cout\ <<\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ <<\ endl;}
\DoxyCodeLine{00486\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};\ \ \ }
\DoxyCodeLine{00487\ \}}
\DoxyCodeLine{00488\ }
\DoxyCodeLine{00489\ \textcolor{comment}{//查询position节点值}}
\DoxyCodeLine{00490\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00491\ T\ \mbox{\hyperlink{classmy__binary__tree_a05b6069959ff87dc7824ce4e05db024a}{my\_binary\_tree<T>::get\_value}}(\textcolor{keywordtype}{string}\ position)\{}
\DoxyCodeLine{00492\ \ \ \ \ \textcolor{keywordtype}{int}\ \textcolor{keywordtype}{size\_t}=position.size();}
\DoxyCodeLine{00493\ \ \ \ \ \textcolor{keywordtype}{int}\ i=0;}
\DoxyCodeLine{00494\ \ \ \ \ \textcolor{keywordtype}{int}\ height=\mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00495\ \ \ \ \ T\ value=0;}
\DoxyCodeLine{00496\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ p=\textcolor{keyword}{this};}
\DoxyCodeLine{00497\ \ \ \ \ \textcolor{keywordflow}{while}(i<height-\/1\&\&i<\textcolor{keywordtype}{size\_t})\{}
\DoxyCodeLine{00498\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'1'})\{}
\DoxyCodeLine{00499\ \ \ \ \ \ \ \ \ \ \ \ \ p=p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00500\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00501\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'0'})\{}
\DoxyCodeLine{00502\ \ \ \ \ \ \ \ \ \ \ \ \ p=p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00503\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00504\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00505\ \ \ \ \ \}}
\DoxyCodeLine{00506\ \ \ \ \ value=p-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};}
\DoxyCodeLine{00507\ \ \ \ \ \textcolor{keyword}{delete}\ p;}
\DoxyCodeLine{00508\ \ \ \ \ cout<<value<<endl;}
\DoxyCodeLine{00509\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00510\ \}\ }
\DoxyCodeLine{00511\ }
\DoxyCodeLine{00512\ \textcolor{comment}{//查询树高}}
\DoxyCodeLine{00513\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00514\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{my\_binary\_tree<T>::get\_height}}()\ \{}
\DoxyCodeLine{00515\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \{}
\DoxyCodeLine{00516\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 0;}
\DoxyCodeLine{00517\ \ \ \ \ \}}
\DoxyCodeLine{00518\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ NULL\ \&\&\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ NULL)\ \{}
\DoxyCodeLine{00519\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{00520\ \ \ \ \ \}}
\DoxyCodeLine{00521\ \ \ \ \ \textcolor{keywordtype}{int}\ left\_h\ =\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>get\_height()\ :\ 0);\ \ \textcolor{comment}{//\ 避免空指针调用}}
\DoxyCodeLine{00522\ \ \ \ \ \textcolor{keywordtype}{int}\ right\_h\ =\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>get\_height()\ :\ 0);}
\DoxyCodeLine{00523\ \ \ \ \ \textcolor{keywordflow}{return}\ 1\ +\ max(left\_h,\ right\_h);}
\DoxyCodeLine{00524\ \}}
\DoxyCodeLine{00525\ }
\DoxyCodeLine{00526\ \textcolor{comment}{//查询h层节点数}}
\DoxyCodeLine{00527\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00528\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_ad8ae3e1b3073a79df62de135e337192a}{my\_binary\_tree<T>::get\_h\_layer\_nodes}}(\textcolor{keywordtype}{int}\ h)\ \{}
\DoxyCodeLine{00529\ \ \ \ \ \textcolor{keywordtype}{int}\ height\ =\ \mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00530\ \ \ \ \ assert((h\ >=\ 1)\ \&\&\ (h\ <=\ height)\ \&\&\ \textcolor{stringliteral}{"{}h\ <\ 1\ ||\ h\ >\ height"{}});}
\DoxyCodeLine{00531\ \ \ \ \ \textcolor{keywordflow}{if}\ (h\ ==\ 1)\ \{}
\DoxyCodeLine{00532\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{00533\ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{00534\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ num\ =\ 0;}
\DoxyCodeLine{00535\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ current\_level\ =\ 1;}
\DoxyCodeLine{00536\ \ \ \ \ \ \ \ \ queue<my\_binary\_tree<T>*>\ q;}
\DoxyCodeLine{00537\ \ \ \ \ \ \ \ \ q.push(\textcolor{keyword}{this});}
\DoxyCodeLine{00538\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (\textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00539\ \ \ \ \ \ \ \ \ \ \ \ \ num\ =\ q.size();}
\DoxyCodeLine{00540\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (current\_level\ ==\ h)\ \{}
\DoxyCodeLine{00541\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00542\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00543\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ num;\ i++)\ \{}
\DoxyCodeLine{00544\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ front\ =\ q.front();}
\DoxyCodeLine{00545\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (front-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \{}
\DoxyCodeLine{00546\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ q.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}});}
\DoxyCodeLine{00547\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00548\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (front-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \{}
\DoxyCodeLine{00549\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ q.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}});}
\DoxyCodeLine{00550\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00551\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ q.pop();}
\DoxyCodeLine{00552\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00553\ \ \ \ \ \ \ \ \ \ \ \ \ current\_level++;}
\DoxyCodeLine{00554\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00555\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ num;}
\DoxyCodeLine{00556\ \ \ \ \ \}}
\DoxyCodeLine{00557\ \}}
\DoxyCodeLine{00558\ }
\DoxyCodeLine{00559\ \textcolor{comment}{//查询最后一层叶子数}}
\DoxyCodeLine{00560\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00561\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_a76f83530b098d7ad84262d21c885c15d}{my\_binary\_tree<T>::get\_last\_layer\_nodes}}()\ \{}
\DoxyCodeLine{00562\ \ \ \ \ \textcolor{keywordtype}{int}\ h\ =\ \mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00563\ \ \ \ \ \textcolor{keywordflow}{return}\ \mbox{\hyperlink{classmy__binary__tree_ad8ae3e1b3073a79df62de135e337192a}{get\_h\_layer\_nodes}}(h);}
\DoxyCodeLine{00564\ \}}
\DoxyCodeLine{00565\ }
\DoxyCodeLine{00566\ \textcolor{comment}{//查询总节点数}}
\DoxyCodeLine{00567\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00568\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{classmy__binary__tree_aabf0c965e92e633f4d25f9b88da19a28}{my\_binary\_tree<T>::get\_nodes\_num}}()\ \{}
\DoxyCodeLine{00569\ \ \ \ \ \textcolor{keywordtype}{int}\ height\ =\ \mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00570\ \ \ \ \ \textcolor{keywordtype}{int}\ sum\ =\ 0;}
\DoxyCodeLine{00571\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 1;\ i\ <=\ height;\ i++)\ \{}
\DoxyCodeLine{00572\ \ \ \ \ \ \ \ \ sum\ +=\ \mbox{\hyperlink{classmy__binary__tree_ad8ae3e1b3073a79df62de135e337192a}{get\_h\_layer\_nodes}}(i);}
\DoxyCodeLine{00573\ \ \ \ \ \}}
\DoxyCodeLine{00574\ \ \ \ \ \textcolor{keywordflow}{return}\ sum;}
\DoxyCodeLine{00575\ \}}
\DoxyCodeLine{00576\ }
\DoxyCodeLine{00577\ \textcolor{comment}{//查询最左/右叶子}}
\DoxyCodeLine{00578\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00579\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a9279b204f13b6f6e79646fe38387607a}{my\_binary\_tree<T>::get\_lrest\_leave}}(\textcolor{keywordtype}{string}\ l\_or\_r)\ \{}
\DoxyCodeLine{00580\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ p\ =\ \textcolor{keyword}{this};}
\DoxyCodeLine{00581\ \ \ \ \ \textcolor{keywordflow}{if}\ (l\_or\_r\ ==\ \textcolor{stringliteral}{"{}left"{}})\ \{}
\DoxyCodeLine{00582\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (p\ \&\&\ p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ !=\ NULL)\ \{\ \ \textcolor{comment}{//\ 增加p非空判断，避免空指针}}
\DoxyCodeLine{00583\ \ \ \ \ \ \ \ \ \ \ \ \ p\ =\ p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00584\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00585\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00586\ \ \ \ \ \}}
\DoxyCodeLine{00587\ \ \ \ \ \textcolor{keywordflow}{if}\ (l\_or\_r\ ==\ \textcolor{stringliteral}{"{}right"{}})\ \{}
\DoxyCodeLine{00588\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (p\ \&\&\ p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ !=\ NULL)\ \{\ \ \textcolor{comment}{//\ 增加p非空判断，避免空指针}}
\DoxyCodeLine{00589\ \ \ \ \ \ \ \ \ \ \ \ \ p\ =\ p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00590\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00591\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00592\ \ \ \ \ \}}
\DoxyCodeLine{00593\ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00594\ \}}
\DoxyCodeLine{00595\ }
\DoxyCodeLine{00596\ \textcolor{comment}{//查询是否为二叉搜索树}}
\DoxyCodeLine{00597\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00598\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_adb685df412bb6481f5167165312868ad}{my\_binary\_tree<T>::is\_binary\_search\_tree}}()\ \{}
\DoxyCodeLine{00599\ \ \ \ \ \textcolor{keywordflow}{if}\ (!\textcolor{keyword}{this})\ \{}
\DoxyCodeLine{00600\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00601\ \ \ \ \ \}}
\DoxyCodeLine{00602\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ \&\&\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>data\ >\ this-\/>data)\ \{}
\DoxyCodeLine{00603\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00604\ \ \ \ \ \}}
\DoxyCodeLine{00605\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ \&\&\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>data\ <\ this-\/>data)\ \{}
\DoxyCodeLine{00606\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00607\ \ \ \ \ \}}
\DoxyCodeLine{00608\ \ \ \ \ \textcolor{keywordtype}{bool}\ left\_bst\ =\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>is\_binary\_search\_tree()\ :\ \textcolor{keyword}{true});}
\DoxyCodeLine{00609\ \ \ \ \ \textcolor{keywordtype}{bool}\ right\_bst\ =\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>is\_binary\_search\_tree()\ :\ \textcolor{keyword}{true});}
\DoxyCodeLine{00610\ \ \ \ \ \textcolor{keywordflow}{return}\ left\_bst\ \&\&\ right\_bst;}
\DoxyCodeLine{00611\ \}}
\DoxyCodeLine{00612\ }
\DoxyCodeLine{00613\ \textcolor{comment}{//查询固定值的叶子}}
\DoxyCodeLine{00614\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00615\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a490bf7f8ebe87b6040b1294f73979fea}{my\_binary\_tree<T>::find}}(\textcolor{keywordtype}{int}\ val)\ \{}
\DoxyCodeLine{00616\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8fc393aceaa7e46fc5fb6b9377c12ea3}{is\_empty}}()\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00617\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00618\ \ \ \ \ \}}
\DoxyCodeLine{00619\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ ==\ val)\ \{}
\DoxyCodeLine{00620\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{this};}
\DoxyCodeLine{00621\ \ \ \ \ \}}
\DoxyCodeLine{00622\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ p\ =\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>find(val)\ :\ NULL);}
\DoxyCodeLine{00623\ \ \ \ \ \textcolor{keywordflow}{if}\ (p\ !=\ NULL)\ \{}
\DoxyCodeLine{00624\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00625\ \ \ \ \ \}}
\DoxyCodeLine{00626\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ q\ =\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>find(val)\ :\ NULL);}
\DoxyCodeLine{00627\ \ \ \ \ \textcolor{keywordflow}{if}\ (q\ !=\ NULL)\ \{}
\DoxyCodeLine{00628\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ q;}
\DoxyCodeLine{00629\ \ \ \ \ \}}
\DoxyCodeLine{00630\ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00631\ \}}
\DoxyCodeLine{00632\ }
\DoxyCodeLine{00633\ \textcolor{comment}{//查询某节点的父节点}}
\DoxyCodeLine{00634\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00635\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_ad767eada19d83ada460c5eb0c2104056}{my\_binary\_tree<T>::find\_father}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ son)\ \{}
\DoxyCodeLine{00636\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8fc393aceaa7e46fc5fb6b9377c12ea3}{is\_empty}}()\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00637\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00638\ \ \ \ \ \}}
\DoxyCodeLine{00639\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ son)\ \{\ \ \textcolor{comment}{//\ 根节点无父节点}}
\DoxyCodeLine{00640\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00641\ \ \ \ \ \}}
\DoxyCodeLine{00642\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ son\ ||\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ son)\ \{}
\DoxyCodeLine{00643\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{this};}
\DoxyCodeLine{00644\ \ \ \ \ \}}
\DoxyCodeLine{00645\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ p\ =\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>find\_father(son)\ :\ NULL);}
\DoxyCodeLine{00646\ \ \ \ \ \textcolor{keywordflow}{if}\ (p\ !=\ NULL)\ \{}
\DoxyCodeLine{00647\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ p;}
\DoxyCodeLine{00648\ \ \ \ \ \}}
\DoxyCodeLine{00649\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ q\ =\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>find\_father(son)\ :\ NULL);}
\DoxyCodeLine{00650\ \ \ \ \ \textcolor{keywordflow}{if}\ (q\ !=\ NULL)\ \{}
\DoxyCodeLine{00651\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ q;}
\DoxyCodeLine{00652\ \ \ \ \ \}}
\DoxyCodeLine{00653\ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{00654\ \}}
\DoxyCodeLine{00655\ }
\DoxyCodeLine{00656\ \textcolor{comment}{//查询是否为平衡二叉树}}
\DoxyCodeLine{00657\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00658\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a35c9081b6b3dfe457c8d29697ccfdfb1}{my\_binary\_tree<T>::is\_balence\_binary\_tree}}()\ \{}
\DoxyCodeLine{00659\ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8fc393aceaa7e46fc5fb6b9377c12ea3}{is\_empty}}()\ ==\ \textcolor{keyword}{true})\ \{}
\DoxyCodeLine{00660\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{true};}
\DoxyCodeLine{00661\ \ \ \ \ \}}
\DoxyCodeLine{00662\ \ \ \ \ \textcolor{keywordtype}{int}\ left\_h\ =\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>get\_height()\ :\ 0);}
\DoxyCodeLine{00663\ \ \ \ \ \textcolor{keywordtype}{int}\ right\_h\ =\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>get\_height()\ :\ 0);}
\DoxyCodeLine{00664\ \ \ \ \ \textcolor{keywordflow}{if}\ (abs(left\_h\ -\/\ right\_h)\ >\ 1)\ \{}
\DoxyCodeLine{00665\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{00666\ \ \ \ \ \}}
\DoxyCodeLine{00667\ \ \ \ \ \textcolor{keywordflow}{return}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>is\_balence\_binary\_tree()\ :\ \textcolor{keyword}{true})\ \&\&\ }
\DoxyCodeLine{00668\ \ \ \ \ \ \ \ \ \ \ \ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ?\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>is\_balence\_binary\_tree()\ :\ \textcolor{keyword}{true});}
\DoxyCodeLine{00669\ \}}
\DoxyCodeLine{00670\ }
\DoxyCodeLine{00671\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/增删相关-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00672\ \textcolor{comment}{//指定左/右子树并追加}}
\DoxyCodeLine{00673\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00674\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_aa23b0dbc0a4f4f7741111867f6d8b2e9}{my\_binary\_tree<T>::append}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ another\_tree,\ \textcolor{keywordtype}{string}\ l\_or\_r)\ \{}
\DoxyCodeLine{00675\ \ \ \ \ \textcolor{keywordflow}{if}\ (l\_or\_r\ ==\ \textcolor{stringliteral}{"{}left"{}})\ \{}
\DoxyCodeLine{00676\ \ \ \ \ \ \ \ \ assert((\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ NULL)\ \&\&\ \textcolor{stringliteral}{"{}illegal:\ left\ is\ not\ NULL"{}});}
\DoxyCodeLine{00677\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ =\ another\_tree;}
\DoxyCodeLine{00678\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00679\ \ \ \ \ \}}
\DoxyCodeLine{00680\ \ \ \ \ \textcolor{keywordflow}{if}\ (l\_or\_r\ ==\ \textcolor{stringliteral}{"{}right"{}})\ \{}
\DoxyCodeLine{00681\ \ \ \ \ \ \ \ \ assert((\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ NULL)\ \&\&\ \textcolor{stringliteral}{"{}illegal:\ right\ is\ not\ NULL"{}});}
\DoxyCodeLine{00682\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ =\ another\_tree;}
\DoxyCodeLine{00683\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00684\ \ \ \ \ \}}
\DoxyCodeLine{00685\ \}}
\DoxyCodeLine{00686\ }
\DoxyCodeLine{00687\ \textcolor{comment}{//复制树}}
\DoxyCodeLine{00688\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00689\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a19f020b91ef749755745ac08d69be0b6}{my\_binary\_tree<T>::copy}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ des,\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ src)\ \{}
\DoxyCodeLine{00690\ \ \ \ \ des-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ =\ src-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};}
\DoxyCodeLine{00691\ \ \ \ \ des-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ =\ src-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00692\ \ \ \ \ des-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ =\ src-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00693\ \}}
\DoxyCodeLine{00694\ }
\DoxyCodeLine{00695\ \textcolor{comment}{//插入节点}}
\DoxyCodeLine{00696\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00697\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a9675071237ce43751138c4fa3ef43657}{my\_binary\_tree<T>::insert}}(T\ val,\ \textcolor{keywordtype}{string}\ position)\ \{}
\DoxyCodeLine{00698\ \ \ \ \ \textcolor{keywordtype}{int}\ \textcolor{keywordtype}{size\_t}=position.size();}
\DoxyCodeLine{00699\ \ \ \ \ \textcolor{keywordtype}{int}\ i=0;}
\DoxyCodeLine{00700\ \ \ \ \ \textcolor{keywordtype}{int}\ height=\mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00701\ \ \ \ \ T\ value=0;}
\DoxyCodeLine{00702\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ p=\textcolor{keyword}{this};}
\DoxyCodeLine{00703\ \ \ \ \ \textcolor{keywordflow}{while}(i<height-\/1\&\&i<\textcolor{keywordtype}{size\_t}-\/1)\{}
\DoxyCodeLine{00704\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'1'})\{}
\DoxyCodeLine{00705\ \ \ \ \ \ \ \ \ \ \ \ \ p=p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00706\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00707\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'0'})\{}
\DoxyCodeLine{00708\ \ \ \ \ \ \ \ \ \ \ \ \ p=p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00709\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00710\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00711\ \ \ \ \ \}}
\DoxyCodeLine{00712\ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'1'})\{}
\DoxyCodeLine{00713\ \ \ \ \ \ \ \ \ assert((p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}==NULL)\&\&\textcolor{stringliteral}{"{}can't\ insert\ at\ an\ existed\ space!'"{}});}
\DoxyCodeLine{00714\ \ \ \ \ \ \ \ \ p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=\textcolor{keyword}{new}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val);\ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00715\ \ \ \ \ \}}
\DoxyCodeLine{00716\ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'0'})\{}
\DoxyCodeLine{00717\ \ \ \ \ \ \ \ \ assert((p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}==NULL)\&\&\textcolor{stringliteral}{"{}can't\ insert\ at\ an\ existed\ space!'"{}});}
\DoxyCodeLine{00718\ \ \ \ \ \ \ \ \ p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=\textcolor{keyword}{new}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val);}
\DoxyCodeLine{00719\ \ \ \ \ \}}
\DoxyCodeLine{00720\ \}}
\DoxyCodeLine{00721\ }
\DoxyCodeLine{00722\ \textcolor{comment}{//删除节点}}
\DoxyCodeLine{00723\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00724\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a24a14198a85ebfd603f5284ef9940e41}{my\_binary\_tree<T>::delete\_point}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ point)\ \{}
\DoxyCodeLine{00725\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ p=\mbox{\hyperlink{classmy__binary__tree_ad767eada19d83ada460c5eb0c2104056}{find\_father}}(point);}
\DoxyCodeLine{00726\ \ \ \ \ \textcolor{keywordflow}{if}(p)\{}
\DoxyCodeLine{00727\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\&\&p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}==point)\{}
\DoxyCodeLine{00728\ \ \ \ \ \ \ \ \ \ \ \ \ p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=NULL;}
\DoxyCodeLine{00729\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00730\ \ \ \ \ \ \ \ \ \}\ \ \ }
\DoxyCodeLine{00731\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\&\&p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}==point)\{}
\DoxyCodeLine{00732\ \ \ \ \ \ \ \ \ \ \ \ \ p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=NULL;}
\DoxyCodeLine{00733\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00734\ \ \ \ \ \ \ \ \ \}\ \ \ }
\DoxyCodeLine{00735\ \ \ \ \ \}}
\DoxyCodeLine{00736\ \ \ \ \ }
\DoxyCodeLine{00737\ \}}
\DoxyCodeLine{00738\ }
\DoxyCodeLine{00739\ \textcolor{comment}{//删除节点}}
\DoxyCodeLine{00740\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00741\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a5fe4fbbeb0729ef67cc258d2a5350860}{my\_binary\_tree<T>::delete\_pos}}(\textcolor{keywordtype}{string}\ position)\ \{}
\DoxyCodeLine{00742\ \ \ \ \ \textcolor{keywordtype}{int}\ \textcolor{keywordtype}{size\_t}=position.size();}
\DoxyCodeLine{00743\ \ \ \ \ \textcolor{keywordtype}{int}\ i=0;}
\DoxyCodeLine{00744\ \ \ \ \ \textcolor{keywordtype}{int}\ height=\mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00745\ \ \ \ \ T\ value=0;}
\DoxyCodeLine{00746\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ p=\textcolor{keyword}{this};}
\DoxyCodeLine{00747\ \ \ \ \ \textcolor{keywordflow}{while}(i<height-\/1\&\&i<\textcolor{keywordtype}{size\_t})\{}
\DoxyCodeLine{00748\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'1'})\{}
\DoxyCodeLine{00749\ \ \ \ \ \ \ \ \ \ \ \ \ p=p-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00750\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00751\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(position[i]==\textcolor{charliteral}{'0'})\{}
\DoxyCodeLine{00752\ \ \ \ \ \ \ \ \ \ \ \ \ p=p-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00753\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00754\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00755\ \ \ \ \ \}}
\DoxyCodeLine{00756\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_a24a14198a85ebfd603f5284ef9940e41}{delete\_point}}(p);}
\DoxyCodeLine{00757\ \}}
\DoxyCodeLine{00758\ }
\DoxyCodeLine{00759\ \textcolor{comment}{//旋转二叉树，默认针对根\ }}
\DoxyCodeLine{00760\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00761\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ \mbox{\hyperlink{classmy__binary__tree_a5842011f1564adb291d8a62f1f7e7625}{my\_binary\_tree<T>::revolve}}(\textcolor{keywordtype}{string}\ mode)\ \{}
\DoxyCodeLine{00762\ \ \ \ \ \textcolor{keywordflow}{if}(mode==\textcolor{stringliteral}{"{}LL"{}})\{}
\DoxyCodeLine{00763\ \ \ \ \ \ \ \ \ \textcolor{comment}{//right成为根，根成为right的left，right的left成为根的right\ }}
\DoxyCodeLine{00764\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ A}}
\DoxyCodeLine{00765\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ B\ \ \ \ \ \ \ C}}
\DoxyCodeLine{00766\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ \ \ D\ \ \ \ E}}
\DoxyCodeLine{00767\ \ \ \ \ \ \ \ \ \textcolor{comment}{//B<A<D<C<E}}
\DoxyCodeLine{00768\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ C}}
\DoxyCodeLine{00769\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ A\ \ \ \ \ \ \ E}}
\DoxyCodeLine{00770\ \ \ \ \ \ \ \ \ \textcolor{comment}{//B\ \ \ D}}
\DoxyCodeLine{00771\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00772\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree1=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00773\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree2=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00774\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00775\ \ \ \ \ \ \ \ \ return\_tree2=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>right;}
\DoxyCodeLine{00776\ \ \ \ \ \ \ \ \ return\_tree1-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};}
\DoxyCodeLine{00777\ \ \ \ \ \ \ \ \ return\_tree1-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00778\ \ \ \ \ \ \ \ \ return\_tree1-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>left;}
\DoxyCodeLine{00779\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00780\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>data;}
\DoxyCodeLine{00781\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=return\_tree1;}
\DoxyCodeLine{00782\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=return\_tree2;}
\DoxyCodeLine{00783\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00784\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ return\_tree;\ \ \ \ \ }
\DoxyCodeLine{00785\ \ \ \ \ }
\DoxyCodeLine{00786\ \ \ \ \ \}}
\DoxyCodeLine{00787\ \ \ \ \ \textcolor{keywordflow}{if}(mode==\textcolor{stringliteral}{"{}RR"{}})\{}
\DoxyCodeLine{00788\ \ \ \ \ \ \ \ \ \textcolor{comment}{//left成为根，根成为left的right，left的right成为根的left}}
\DoxyCodeLine{00789\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ A}}
\DoxyCodeLine{00790\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ B\ \ \ \ \ \ \ E}}
\DoxyCodeLine{00791\ \ \ \ \ \ \ \ \ \textcolor{comment}{//C\ \ \ D}}
\DoxyCodeLine{00792\ \ \ \ \ \ \ \ \ \textcolor{comment}{//C<B<D<A<E}}
\DoxyCodeLine{00793\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ B}}
\DoxyCodeLine{00794\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ C\ \ \ \ \ \ \ A}}
\DoxyCodeLine{00795\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ \ \ D\ \ \ E}}
\DoxyCodeLine{00796\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00797\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree1=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00798\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree2=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00799\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00800\ \ \ \ \ \ \ \ \ return\_tree1=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>left;}
\DoxyCodeLine{00801\ \ \ \ \ \ \ \ \ return\_tree2-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};}
\DoxyCodeLine{00802\ \ \ \ \ \ \ \ \ return\_tree2-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>right;}
\DoxyCodeLine{00803\ \ \ \ \ \ \ \ \ return\_tree2-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00804\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00805\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>data;}
\DoxyCodeLine{00806\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=return\_tree1;}
\DoxyCodeLine{00807\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=return\_tree2;}
\DoxyCodeLine{00808\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00809\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ return\_tree;\ \ \ \ \ }
\DoxyCodeLine{00810\ \ \ \ \ \}}
\DoxyCodeLine{00811\ \ \ \ \ \textcolor{keywordflow}{if}(mode==\textcolor{stringliteral}{"{}LR"{}})\{}
\DoxyCodeLine{00812\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ A}}
\DoxyCodeLine{00813\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ B\ \ \ \ \ C}}
\DoxyCodeLine{00814\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ D\ \ \ E}}
\DoxyCodeLine{00815\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ H\ \ I}}
\DoxyCodeLine{00816\ \ \ \ \ \ \ \ \ \textcolor{comment}{//D<B<H<E<I<A<C}}
\DoxyCodeLine{00817\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ E}}
\DoxyCodeLine{00818\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ B\ \ \ A}}
\DoxyCodeLine{00819\ \ \ \ \ \ \ \ \ \textcolor{comment}{//D\ \ H\ I\ \ C}}
\DoxyCodeLine{00820\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00821\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree1=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00822\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree2=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00823\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00824\ \ \ \ \ \ \ \ \ return\_tree1=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};}
\DoxyCodeLine{00825\ \ \ \ \ \ \ \ \ return\_tree1-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>right-\/>left;}
\DoxyCodeLine{00826\ \ \ \ \ \ \ \ \ return\_tree2=\textcolor{keyword}{this};}
\DoxyCodeLine{00827\ \ \ \ \ \ \ \ \ return\_tree2-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>right-\/>right;}
\DoxyCodeLine{00828\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00829\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>right-\/>data;}
\DoxyCodeLine{00830\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=return\_tree1;}
\DoxyCodeLine{00831\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=return\_tree2;}
\DoxyCodeLine{00832\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00833\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ return\_tree;\ \ \ \ \ }
\DoxyCodeLine{00834\ \ \ \ \ \}}
\DoxyCodeLine{00835\ \ \ \ \ \textcolor{keywordflow}{if}(mode==\textcolor{stringliteral}{"{}RL"{}})\{}
\DoxyCodeLine{00836\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ A}}
\DoxyCodeLine{00837\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ B\ \ \ \ \ \ \ C}}
\DoxyCodeLine{00838\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ \ \ D\ \ \ E}}
\DoxyCodeLine{00839\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ F\ \ G}}
\DoxyCodeLine{00840\ \ \ \ \ \ \ \ \ \textcolor{comment}{//B<A<D<C<E}}
\DoxyCodeLine{00841\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ \ \ \ \ D}}
\DoxyCodeLine{00842\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ \ A\ \ \ \ \ \ C}}
\DoxyCodeLine{00843\ \ \ \ \ \ \ \ \ \textcolor{comment}{//B\ \ \ F\ \ \ \ G\ \ \ E}}
\DoxyCodeLine{00844\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00845\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree1=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00846\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ return\_tree2=(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*)malloc(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}));}
\DoxyCodeLine{00847\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00848\ \ \ \ \ \ \ \ \ return\_tree1=\textcolor{keyword}{this};}
\DoxyCodeLine{00849\ \ \ \ \ \ \ \ \ return\_tree1-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>left-\/>left;}
\DoxyCodeLine{00850\ \ \ \ \ \ \ \ \ return\_tree2=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{00851\ \ \ \ \ \ \ \ \ return\_tree2-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>left-\/>right;}
\DoxyCodeLine{00852\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00853\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>left-\/>data;}
\DoxyCodeLine{00854\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=return\_tree1;}
\DoxyCodeLine{00855\ \ \ \ \ \ \ \ \ return\_tree-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=return\_tree2;}
\DoxyCodeLine{00856\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00857\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ return\_tree;\ \ \ \ \ }
\DoxyCodeLine{00858\ \ \ \ \ }
\DoxyCodeLine{00859\ \ \ \ \ \}}
\DoxyCodeLine{00860\ \}}
\DoxyCodeLine{00861\ }
\DoxyCodeLine{00862\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/遍历操作-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{00863\ \textcolor{comment}{//遍历树,并打印}}
\DoxyCodeLine{00864\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00865\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_a3b473ee42358d2ecda1958b1b72fd1dd}{my\_binary\_tree<T>::show\_binary\_tree}}(\textcolor{keywordtype}{string}\ mode)\ \{}
\DoxyCodeLine{00866\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}first\_root"{}})\ \{\ \ \textcolor{comment}{//\ 先序遍历}}
\DoxyCodeLine{00867\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00868\ \ \ \ \ \ \ \ \ cout\ <<\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ <<\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00869\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>show\_binary\_tree(\textcolor{stringliteral}{"{}first\_root"{}});}
\DoxyCodeLine{00870\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>show\_binary\_tree(\textcolor{stringliteral}{"{}first\_root"{}});}
\DoxyCodeLine{00871\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00872\ \ \ \ \ \}}
\DoxyCodeLine{00873\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}mid\_root"{}})\ \{\ \ \textcolor{comment}{//\ 中序遍历}}
\DoxyCodeLine{00874\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00875\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>show\_binary\_tree(\textcolor{stringliteral}{"{}mid\_root"{}});}
\DoxyCodeLine{00876\ \ \ \ \ \ \ \ \ cout\ <<\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ <<\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00877\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>show\_binary\_tree(\textcolor{stringliteral}{"{}mid\_root"{}});}
\DoxyCodeLine{00878\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00879\ \ \ \ \ \}}
\DoxyCodeLine{00880\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}last\_root"{}})\ \{\ \ \textcolor{comment}{//\ 后序遍历}}
\DoxyCodeLine{00881\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00882\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>show\_binary\_tree(\textcolor{stringliteral}{"{}last\_root"{}});}
\DoxyCodeLine{00883\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>show\_binary\_tree(\textcolor{stringliteral}{"{}last\_root"{}});}
\DoxyCodeLine{00884\ \ \ \ \ \ \ \ \ cout\ <<\ \mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ <<\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00885\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00886\ \ \ \ \ \}}
\DoxyCodeLine{00887\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}layer\_first"{}})\ \{\ \ \textcolor{comment}{//\ 层序遍历}}
\DoxyCodeLine{00888\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00889\ \ \ \ \ \ \ \ \ queue<my\_binary\_tree<T>*>\ layer\_first\_queue;}
\DoxyCodeLine{00890\ \ \ \ \ \ \ \ \ layer\_first\_queue.push(\textcolor{keyword}{this});}
\DoxyCodeLine{00891\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (!layer\_first\_queue.empty())\ \{}
\DoxyCodeLine{00892\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ front\ =\ layer\_first\_queue.front();}
\DoxyCodeLine{00893\ \ \ \ \ \ \ \ \ \ \ \ \ cout\ <<\ front-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ <<\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{00894\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (front-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \{}
\DoxyCodeLine{00895\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}});}
\DoxyCodeLine{00896\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00897\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (front-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \{}
\DoxyCodeLine{00898\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}});}
\DoxyCodeLine{00899\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00900\ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.pop();}
\DoxyCodeLine{00901\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00902\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return};}
\DoxyCodeLine{00903\ \ \ \ \ \}}
\DoxyCodeLine{00904\ \}}
\DoxyCodeLine{00905\ }
\DoxyCodeLine{00906\ \textcolor{comment}{//遍历树,传入函数指针进行操作}}
\DoxyCodeLine{00907\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00908\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ Function>}
\DoxyCodeLine{00909\ Function\ \mbox{\hyperlink{classmy__binary__tree_a4a4f092d8f75d1f8840db3c3b4b6f36e}{my\_binary\_tree<T>::traversal\_binary\_tree}}(\textcolor{keywordtype}{string}\ mode,\ Function\ F)\ \{}
\DoxyCodeLine{00910\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}first\_root"{}})\ \{}
\DoxyCodeLine{00911\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00912\ \ \ \ \ \ \ \ \ F(\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{00913\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}first\_root"{}},\ F);}
\DoxyCodeLine{00914\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}first\_root"{}},\ F);}
\DoxyCodeLine{00915\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00916\ \ \ \ \ \}}
\DoxyCodeLine{00917\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}mid\_root"{}})\ \{}
\DoxyCodeLine{00918\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00919\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}mid\_root"{}},\ F);}
\DoxyCodeLine{00920\ \ \ \ \ \ \ \ \ F(\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{00921\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}mid\_root"{}},\ F);}
\DoxyCodeLine{00922\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00923\ \ \ \ \ \}}
\DoxyCodeLine{00924\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}last\_root"{}})\ \{}
\DoxyCodeLine{00925\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00926\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}last\_root"{}},\ F);}
\DoxyCodeLine{00927\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}last\_root"{}},\ F);}
\DoxyCodeLine{00928\ \ \ \ \ \ \ \ \ F(\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{00929\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00930\ \ \ \ \ \}}
\DoxyCodeLine{00931\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}layer\_first"{}})\ \{}
\DoxyCodeLine{00932\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00933\ \ \ \ \ \ \ \ \ queue<my\_binary\_tree<T>*>\ layer\_first\_queue;}
\DoxyCodeLine{00934\ \ \ \ \ \ \ \ \ layer\_first\_queue.push(\textcolor{keyword}{this});}
\DoxyCodeLine{00935\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (!layer\_first\_queue.empty())\ \{}
\DoxyCodeLine{00936\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ front\ =\ layer\_first\_queue.front();}
\DoxyCodeLine{00937\ \ \ \ \ \ \ \ \ \ \ \ \ F(front-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{00938\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (front-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \{}
\DoxyCodeLine{00939\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}});}
\DoxyCodeLine{00940\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00941\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (front-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \{}
\DoxyCodeLine{00942\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}});}
\DoxyCodeLine{00943\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00944\ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.pop();}
\DoxyCodeLine{00945\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00946\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00947\ \ \ \ \ \}}
\DoxyCodeLine{00948\ \ \ \ \ \textcolor{keywordflow}{return}\ F;}
\DoxyCodeLine{00949\ \}}
\DoxyCodeLine{00950\ }
\DoxyCodeLine{00951\ \textcolor{comment}{//遍历树,传入函数指针（含空节点处理）}}
\DoxyCodeLine{00952\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00953\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ Function1,\ \textcolor{keyword}{typename}\ Function2>}
\DoxyCodeLine{00954\ Function1\ \mbox{\hyperlink{classmy__binary__tree_a4a4f092d8f75d1f8840db3c3b4b6f36e}{my\_binary\_tree<T>::traversal\_binary\_tree}}(\textcolor{keywordtype}{string}\ mode,\ Function1\ F1,\ Function2\ F2)\ \{}
\DoxyCodeLine{00955\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}first\_root"{}})\ \{}
\DoxyCodeLine{00956\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \{}
\DoxyCodeLine{00957\ \ \ \ \ \ \ \ \ \ \ \ \ F2();}
\DoxyCodeLine{00958\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{00959\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00960\ \ \ \ \ \ \ \ \ F1(\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{00961\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}first\_root"{}},\ F1,\ F2);}
\DoxyCodeLine{00962\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ F2();\ \ \textcolor{comment}{//\ 左子树为空时调用F2}}
\DoxyCodeLine{00963\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}first\_root"{}},\ F1,\ F2);}
\DoxyCodeLine{00964\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ F2();\ \ \textcolor{comment}{//\ 右子树为空时调用F2}}
\DoxyCodeLine{00965\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{00966\ \ \ \ \ \}}
\DoxyCodeLine{00967\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}mid\_root"{}})\ \{}
\DoxyCodeLine{00968\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \{}
\DoxyCodeLine{00969\ \ \ \ \ \ \ \ \ \ \ \ \ F2();}
\DoxyCodeLine{00970\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{00971\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00972\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}mid\_root"{}},\ F1,\ F2);}
\DoxyCodeLine{00973\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ F2();}
\DoxyCodeLine{00974\ \ \ \ \ \ \ \ \ F1(\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{00975\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}mid\_root"{}},\ F1,\ F2);}
\DoxyCodeLine{00976\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ F2();}
\DoxyCodeLine{00977\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{00978\ \ \ \ \ \}}
\DoxyCodeLine{00979\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}last\_root"{}})\ \{}
\DoxyCodeLine{00980\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \{}
\DoxyCodeLine{00981\ \ \ \ \ \ \ \ \ \ \ \ \ F2();}
\DoxyCodeLine{00982\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{00983\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00984\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ \mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}last\_root"{}},\ F1,\ F2);}
\DoxyCodeLine{00985\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ F2();}
\DoxyCodeLine{00986\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ \mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}-\/>traversal\_binary\_tree(\textcolor{stringliteral}{"{}last\_root"{}},\ F1,\ F2);}
\DoxyCodeLine{00987\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ F2();}
\DoxyCodeLine{00988\ \ \ \ \ \ \ \ \ F1(\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{00989\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{00990\ \ \ \ \ \}}
\DoxyCodeLine{00991\ \ \ \ \ \textcolor{keywordflow}{if}\ (mode\ ==\ \textcolor{stringliteral}{"{}layer\_first"{}})\ \{}
\DoxyCodeLine{00992\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ height\ =\ \mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{00993\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ level\ =\ 1;}
\DoxyCodeLine{00994\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ num\ =\ 1;}
\DoxyCodeLine{00995\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ NULL)\ \{}
\DoxyCodeLine{00996\ \ \ \ \ \ \ \ \ \ \ \ \ F2();}
\DoxyCodeLine{00997\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{00998\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00999\ \ \ \ \ \ \ \ \ queue<my\_binary\_tree<T>*>\ layer\_first\_queue;}
\DoxyCodeLine{01000\ \ \ \ \ \ \ \ \ layer\_first\_queue.push(\textcolor{keyword}{this});}
\DoxyCodeLine{01001\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{while}\ (level\ <=\ height)\ \{}
\DoxyCodeLine{01002\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}*\ front\ =\ layer\_first\_queue.front();}
\DoxyCodeLine{01003\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (front\ ==\ NULL)\ \{}
\DoxyCodeLine{01004\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ F2();}
\DoxyCodeLine{01005\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(NULL);}
\DoxyCodeLine{01006\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(NULL);}
\DoxyCodeLine{01007\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{01008\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ function\_counter\ =\ num\ -\/\ 1;}
\DoxyCodeLine{01009\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ F1(front-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{01010\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}});\ \ \textcolor{comment}{//\ 空指针会被后续处理}}
\DoxyCodeLine{01011\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.push(front-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}});}
\DoxyCodeLine{01012\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01013\ \ \ \ \ \ \ \ \ \ \ \ \ layer\_first\_queue.pop();}
\DoxyCodeLine{01014\ \ \ \ \ \ \ \ \ \ \ \ \ num++;}
\DoxyCodeLine{01015\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (is\_2\_power(num,\ height))\ \{}
\DoxyCodeLine{01016\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ level++;}
\DoxyCodeLine{01017\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01018\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01019\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{01020\ \ \ \ \ \}}
\DoxyCodeLine{01021\ \ \ \ \ \textcolor{keywordflow}{return}\ F1;}
\DoxyCodeLine{01022\ \}}
\DoxyCodeLine{01023\ }
\DoxyCodeLine{01024\ \textcolor{comment}{//按照层先法压入向量中（不含占位符）}}
\DoxyCodeLine{01025\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01026\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_aff9c3c138c4fc970016a826ec0653eaf}{my\_binary\_tree<T>::print\_full\_to\_vector}}(vector<T>\&\ vv)\ \{}
\DoxyCodeLine{01027\ \ \ \ \ \textcolor{keyword}{auto}\ bound\_func\ =\ bind(print\_fulltov,\ ref(vv),\ placeholders::\_1);}
\DoxyCodeLine{01028\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_a4a4f092d8f75d1f8840db3c3b4b6f36e}{traversal\_binary\_tree}}(\textcolor{stringliteral}{"{}layer\_first"{}},\ bound\_func);}
\DoxyCodeLine{01029\ \}}
\DoxyCodeLine{01030\ }
\DoxyCodeLine{01031\ \textcolor{comment}{//按照层先法压入向量中（含占位符）}}
\DoxyCodeLine{01032\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01033\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{classmy__binary__tree_aa65e9e0bae93b835e20c32de429928d3}{my\_binary\_tree<T>::print\_to\_vector}}(vector<T>\&\ vv)\ \{}
\DoxyCodeLine{01034\ \ \ \ \ \textcolor{keyword}{auto}\ bound\_func1\ =\ bind(print\_tov,\ ref(vv),\ placeholders::\_1);}
\DoxyCodeLine{01035\ \ \ \ \ \mbox{\hyperlink{classmy__binary__tree_a4a4f092d8f75d1f8840db3c3b4b6f36e}{traversal\_binary\_tree}}(\textcolor{stringliteral}{"{}layer\_first"{}},\ bound\_func1,\ empty\_function);}
\DoxyCodeLine{01036\ \}}
\DoxyCodeLine{01037\ }
\DoxyCodeLine{01038\ \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/操作符重载-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{01039\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01040\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a9b5581a82079878a7faac62d07bbcc12}{operator==}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\ lhs,\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\ rhs)\ \{}
\DoxyCodeLine{01041\ \ \ \ \ \textcolor{keywordflow}{if}\ (lhs.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ NULL\ \&\&\ lhs.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ NULL\ \&\&}
\DoxyCodeLine{01042\ \ \ \ \ \ \ \ \ rhs.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ NULL\ \&\&\ rhs.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ NULL)\ \{}
\DoxyCodeLine{01043\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lhs.\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ ==\ rhs.\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}};}
\DoxyCodeLine{01044\ \ \ \ \ \}}
\DoxyCodeLine{01045\ \ \ \ \ \textcolor{keywordflow}{if}\ ((lhs.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ NULL)\ !=\ (rhs.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ NULL)\ ||}
\DoxyCodeLine{01046\ \ \ \ \ \ \ \ \ (lhs.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ NULL)\ !=\ (rhs.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ NULL))\ \{}
\DoxyCodeLine{01047\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{false};}
\DoxyCodeLine{01048\ \ \ \ \ \}}
\DoxyCodeLine{01049\ \ \ \ \ \textcolor{keywordtype}{bool}\ currentEqual\ =\ (lhs.\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}\ ==\ rhs.\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}});}
\DoxyCodeLine{01050\ \ \ \ \ \textcolor{keywordtype}{bool}\ leftEqual\ =\ (lhs.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ !=\ NULL)\ ?\ (*lhs.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ ==\ *rhs.\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\ :\ \textcolor{keyword}{true};}
\DoxyCodeLine{01051\ \ \ \ \ \textcolor{keywordtype}{bool}\ rightEqual\ =\ (lhs.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ !=\ NULL)\ ?\ (*lhs.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ ==\ *rhs.\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}})\ :\ \textcolor{keyword}{true};}
\DoxyCodeLine{01052\ \ \ \ \ \textcolor{keywordflow}{return}\ currentEqual\ \&\&\ leftEqual\ \&\&\ rightEqual;}
\DoxyCodeLine{01053\ \}}
\DoxyCodeLine{01054\ }
\DoxyCodeLine{01055\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01056\ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{classmy__binary__tree_a57bcf0e8e11dcb2db4d3c2b72e62d913}{operator!=}}(\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\ lhs,\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\ rhs)\ \{}
\DoxyCodeLine{01057\ \ \ \ \ \textcolor{keywordflow}{return}\ !(lhs\ ==\ rhs);}
\DoxyCodeLine{01058\ \}}
\DoxyCodeLine{01059\ }
\DoxyCodeLine{01060\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01061\ ostream\&\ \mbox{\hyperlink{classmy__binary__tree_a9b9d88b02caf22fc6de3a78e3a514816}{operator<<}}(ostream\&\ os,\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}\ p)\ \{}
\DoxyCodeLine{01062\ \ \ \ \ os\ <<\ \textcolor{stringliteral}{"{}now\ let's\ draw\ a\ tree"{}}\ <<\ endl;}
\DoxyCodeLine{01063\ \ \ \ \ \textcolor{keywordtype}{int}\ height\ =\ p.\mbox{\hyperlink{classmy__binary__tree_a047c1a5b1fb76a0cb62700eb1c53bb8b}{get\_height}}();}
\DoxyCodeLine{01064\ \ \ \ \ \textcolor{keywordtype}{int}\ h\ =\ 1;}
\DoxyCodeLine{01065\ \ \ \ \ vector<int>\ sum\_pow\_of\_2;}
\DoxyCodeLine{01066\ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 1;\ j\ <=\ height;\ j++)\ \{}
\DoxyCodeLine{01067\ \ \ \ \ \ \ \ \ sum\_pow\_of\_2.push\_back(pow(2,\ j)\ -\/\ 1);}
\DoxyCodeLine{01068\ \ \ \ \ \}}
\DoxyCodeLine{01069\ \ \ \ \ \textcolor{keywordtype}{int}\ sum\ =\ pow(2,\ height)\ -\/\ 1;}
\DoxyCodeLine{01070\ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
\DoxyCodeLine{01071\ \ \ \ \ vector<T>\ vv(sum,\ space);\ \ \textcolor{comment}{//\ 初始化向量为占位符}}
\DoxyCodeLine{01072\ \ \ \ \ p.\mbox{\hyperlink{classmy__binary__tree_aa65e9e0bae93b835e20c32de429928d3}{print\_to\_vector}}(vv);}
\DoxyCodeLine{01073\ \ \ \ \ os\ <<\ \textcolor{stringliteral}{"{}-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/"{}}\ <<\ endl;}
\DoxyCodeLine{01074\ \ \ \ \ \textcolor{keywordflow}{while}\ (i\ <\ sum)\ \{}
\DoxyCodeLine{01075\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ num\_space\ =\ clac\_space(h,\ height);}
\DoxyCodeLine{01076\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ k\ =\ 0;\ k\ <\ num\_space;\ k++)\ \{}
\DoxyCodeLine{01077\ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{01078\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01079\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (vv[i]\ !=\ space)\ \{}
\DoxyCodeLine{01080\ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ vv[i];}
\DoxyCodeLine{01081\ \ \ \ \ \ \ \ \ \}\ \textcolor{keywordflow}{else}\ \{}
\DoxyCodeLine{01082\ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ \textcolor{charliteral}{'*'};}
\DoxyCodeLine{01083\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01084\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ k\ =\ 0;\ k\ <\ num\_space;\ k++)\ \{}
\DoxyCodeLine{01085\ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ \textcolor{charliteral}{'\ '};}
\DoxyCodeLine{01086\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01087\ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ it\ =\ \mbox{\hyperlink{classmy__binary__tree_a490bf7f8ebe87b6040b1294f73979fea}{find}}(sum\_pow\_of\_2.begin(),\ sum\_pow\_of\_2.end(),\ i\ +\ 1);}
\DoxyCodeLine{01088\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (it\ !=\ sum\_pow\_of\_2.end())\ \{}
\DoxyCodeLine{01089\ \ \ \ \ \ \ \ \ \ \ \ \ h++;}
\DoxyCodeLine{01090\ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ endl;}
\DoxyCodeLine{01091\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01092\ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{01093\ \ \ \ \ \}}
\DoxyCodeLine{01094\ \ \ \ \ os\ <<\ \textcolor{stringliteral}{"{}-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/"{}}\ <<\ endl;}
\DoxyCodeLine{01095\ \ \ \ \ \textcolor{keywordflow}{return}\ os;}
\DoxyCodeLine{01096\ \}}
\DoxyCodeLine{01097\ }
\DoxyCodeLine{01098\ }
\DoxyCodeLine{01099\ }
\DoxyCodeLine{01100\ }
\DoxyCodeLine{01101\ }
\DoxyCodeLine{01102\ }
\DoxyCodeLine{01103\ }
\DoxyCodeLine{01104\ }
\DoxyCodeLine{01105\ }
\DoxyCodeLine{01106\ }
\DoxyCodeLine{01107\ }
\DoxyCodeLine{01108\ }
\DoxyCodeLine{01109\ }
\DoxyCodeLine{01110\ }
\DoxyCodeLine{01111\ }
\DoxyCodeLine{01112\ }
\DoxyCodeLine{01118\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01119\ \textcolor{keyword}{class\ }my\_balence\_binary\_tree:\textcolor{keyword}{public}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}<T>\{}
\DoxyCodeLine{01120\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{01121\ \ \ \ \ \ \ \ \ my\_balence\_binary\_tree(T\ val):\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val)\{}
\DoxyCodeLine{01122\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=val;}
\DoxyCodeLine{01123\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=NULL;}
\DoxyCodeLine{01124\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=NULL;}
\DoxyCodeLine{01125\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01126\ \ \ \ \ \ \ \ \ \string~my\_balence\_binary\_tree()\{}
\DoxyCodeLine{01127\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01128\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01129\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01130\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01131\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{01132\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ }
\DoxyCodeLine{01133\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01134\ \};}
\DoxyCodeLine{01135\ }
\DoxyCodeLine{01136\ }
\DoxyCodeLine{01137\ }
\DoxyCodeLine{01138\ }
\DoxyCodeLine{01139\ }
\DoxyCodeLine{01140\ }
\DoxyCodeLine{01141\ }
\DoxyCodeLine{01147\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01148\ \textcolor{keyword}{class\ }my\_binary\_search\_tree:\textcolor{keyword}{public}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}<T>\{}
\DoxyCodeLine{01149\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{01150\ \ \ \ \ \ \ \ \ my\_binary\_search\_tree(T\ val):\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val)\{}
\DoxyCodeLine{01151\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=val;}
\DoxyCodeLine{01152\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=NULL;}
\DoxyCodeLine{01153\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=NULL;}
\DoxyCodeLine{01154\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01155\ \ \ \ \ \ \ \ \ \string~my\_binary\_search\_tree()\{}
\DoxyCodeLine{01156\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01157\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01158\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01159\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01160\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{01161\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ }
\DoxyCodeLine{01162\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01163\ \};}
\DoxyCodeLine{01164\ }
\DoxyCodeLine{01165\ }
\DoxyCodeLine{01166\ }
\DoxyCodeLine{01167\ }
\DoxyCodeLine{01168\ }
\DoxyCodeLine{01169\ }
\DoxyCodeLine{01175\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01176\ \textcolor{keyword}{class\ }my\_complete\_binary\_tree:\textcolor{keyword}{public}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}<T>\{}
\DoxyCodeLine{01177\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{01178\ \ \ \ \ \ \ \ \ my\_complete\_binary\_tree(T\ val):\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val)\{}
\DoxyCodeLine{01179\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=val;}
\DoxyCodeLine{01180\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=NULL;}
\DoxyCodeLine{01181\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=NULL;}
\DoxyCodeLine{01182\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01183\ \ \ \ \ \ \ \ \ \string~my\_complete\_binary\_tree()\{}
\DoxyCodeLine{01184\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01185\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01186\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01187\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01188\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{01189\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ }
\DoxyCodeLine{01190\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01191\ \ \ \ \ }
\DoxyCodeLine{01192\ \};}
\DoxyCodeLine{01193\ }
\DoxyCodeLine{01194\ }
\DoxyCodeLine{01200\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01201\ \textcolor{keyword}{class\ }my\_full\_binary\_tree:\textcolor{keyword}{public}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}<T>\{\ \ \ \ }
\DoxyCodeLine{01202\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{01203\ \ \ \ \ \ \ \ \ my\_full\_binary\_tree(T\ val):\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val)\ \{}
\DoxyCodeLine{01204\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=val;}
\DoxyCodeLine{01205\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=NULL;}
\DoxyCodeLine{01206\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=NULL;}
\DoxyCodeLine{01207\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01208\ \ \ \ \ \ \ \ \ \string~my\_full\_binary\_tree()\{}
\DoxyCodeLine{01209\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01210\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01211\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01212\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01213\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{01214\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ }
\DoxyCodeLine{01215\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01216\ \ \ \ \ }
\DoxyCodeLine{01224\ \ \ \ \ \ \ \ \ my\_full\_binary\_tree<T>*\ \mbox{\hyperlink{classmy__full__binary__tree_abc576874d3f353e19c3e4ef154b6c039}{construct\_full\_binary\_tree}}(vector<T>\ values,\ \textcolor{keywordtype}{int}\ index);}
\DoxyCodeLine{01225\ \ \ \ \ }
\DoxyCodeLine{01226\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01227\ \};}
\DoxyCodeLine{01228\ \textcolor{comment}{//\ 层先法构造满二叉树的函数}}
\DoxyCodeLine{01229\ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01230\ my\_full\_binary\_tree<T>*\ \mbox{\hyperlink{classmy__full__binary__tree_abc576874d3f353e19c3e4ef154b6c039}{my\_full\_binary\_tree<T>::construct\_full\_binary\_tree}}(vector<T>\ values,\ \textcolor{keywordtype}{int}\ index)\ \{}
\DoxyCodeLine{01231\ \ \ \ \ \textcolor{keywordflow}{if}\ (index\ >=\ values.size())\ \{}
\DoxyCodeLine{01232\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ NULL;}
\DoxyCodeLine{01233\ \ \ \ \ \}}
\DoxyCodeLine{01234\ \ \ \ \ my\_full\_binary\_tree<T>*\ node\ =\ \textcolor{keyword}{new}\ my\_full\_binary\_tree(values[index]);}
\DoxyCodeLine{01235\ \ \ \ \ node-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}\ =\ \mbox{\hyperlink{classmy__full__binary__tree_abc576874d3f353e19c3e4ef154b6c039}{construct\_full\_binary\_tree}}(values,\ 2\ *\ index\ +\ 1);}
\DoxyCodeLine{01236\ \ \ \ \ node-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}\ =\ \mbox{\hyperlink{classmy__full__binary__tree_abc576874d3f353e19c3e4ef154b6c039}{construct\_full\_binary\_tree}}(values,\ 2\ *\ index\ +\ 2);}
\DoxyCodeLine{01237\ \ \ \ \ \textcolor{keywordflow}{return}\ node;}
\DoxyCodeLine{01238\ \}}
\DoxyCodeLine{01239\ }
\DoxyCodeLine{01240\ }
\DoxyCodeLine{01241\ }
\DoxyCodeLine{01247\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01248\ \textcolor{keyword}{class\ }my\_binary\_heap\_tree:\textcolor{keyword}{public}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}<T>\{}
\DoxyCodeLine{01249\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{01250\ \ \ \ \ \ \ \ \ my\_binary\_heap\_tree(T\ val):\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val)\{}
\DoxyCodeLine{01251\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=val;}
\DoxyCodeLine{01252\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=NULL;}
\DoxyCodeLine{01253\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=NULL;}
\DoxyCodeLine{01254\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01255\ \ \ \ \ \ \ \ \ \string~my\_binary\_heap\_tree()\{}
\DoxyCodeLine{01256\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01257\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01258\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01259\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01260\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{01261\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ }
\DoxyCodeLine{01262\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01263\ \};}
\DoxyCodeLine{01264\ }
\DoxyCodeLine{01265\ }
\DoxyCodeLine{01266\ }
\DoxyCodeLine{01267\ }
\DoxyCodeLine{01268\ }
\DoxyCodeLine{01274\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{01275\ \textcolor{keyword}{class\ }my\_Huffman\_binary\_tree:\textcolor{keyword}{public}\ \mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree}}<T>\{}
\DoxyCodeLine{01276\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{01277\ \ \ \ \ \ \ \ \ my\_Huffman\_binary\_tree(T\ val):\mbox{\hyperlink{classmy__binary__tree_ae19ca02504d47a17836f0b0c533f8982}{my\_binary\_tree<T>}}(val)\{}
\DoxyCodeLine{01278\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_ae2d15edcaec6e5543a5e8c64ea0173cb}{data}}=val;}
\DoxyCodeLine{01279\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}}=NULL;}
\DoxyCodeLine{01280\ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}}=NULL;}
\DoxyCodeLine{01281\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01282\ \ \ \ \ \ \ \ \ \string~my\_Huffman\_binary\_tree()\{}
\DoxyCodeLine{01283\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01284\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}};\ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{01285\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01286\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}(this-\/>\mbox{\hyperlink{classmy__binary__tree_a69a6f187348e8b6219809620e784d3cf}{left}})\{}
\DoxyCodeLine{01287\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{delete}\ this-\/>\mbox{\hyperlink{classmy__binary__tree_a8910dc810a9a95fe4dc308eeef739b6a}{right}};}
\DoxyCodeLine{01288\ \ \ \ \ \ \ \ \ \ \ \ \ \}\ }
\DoxyCodeLine{01289\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{01290\ \};}
\DoxyCodeLine{01291\ }

\end{DoxyCode}
